package online.shenme.day11;

import java.io.*;

public class BufferStreamTest {
    public static void main(String[] args) throws IOException {
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("javaadvance\\src\\online\\shenme\\day11\\test.txt"));
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("javaadvance\\src\\online\\shenme\\day11\\test1.txt"));
//        method1(bis, bos);
        bos.write("中国".getBytes("gbk"));
        System.out.println(new String(bis.readAllBytes(),"gbk"));
        bis.close();
        bos.close();
    }

    private static void method1(BufferedInputStream bis, BufferedOutputStream bos) throws IOException {
        int len;
        byte[] bytes = new byte[1024];
        while ((len = bis.read(bytes)) != -1) {
            bos.write(bytes,0,len);
        }
    }
}
